package com.bwie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.domain.Order;
import com.bwie.service.OrderService;
import com.bwie.mapper.OrderMapper;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
* @author 36167
* @description 针对表【order(订单表)】的数据库操作Service实现
* @createDate 2025-03-11 19:48:50
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>
    implements OrderService{

    @Autowired
    OrderMapper orderMapper;

    @Override
    public R orderadd(Order order) {
        order.setCreateTime(new Date());
      boolean save=   orderMapper.add(order);
        return save == true?R.OK("添加成功"):R.ERROR(500,"添加失败");
    }

    @Override
    public R orderlist() {
        List<Order> orders = orderMapper.list(null);
        return R.OK(orders);
    }
}




